package com.example.demo.serializer;

import com.alibaba.fastjson.JSON;
import com.example.demo.entity.UserLogInfo;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.serialization.Deserializer;

import java.util.Map;

public class UserLogDeserializer implements Deserializer<UserLogInfo> {


    @Override
    public void configure(Map<String, ?> configs, boolean isKey) {

    }

    @Override
    public UserLogInfo deserialize(String topic, byte[] data) {
        if (null == data) {
            return new UserLogInfo();
        }
        String info = new String(data);
        return JSON.parseObject(info, UserLogInfo.class);
    }


    @Override
    public void close() {

    }
}
